package cn.fscode.code.generator.template.custom_var;

import cn.hutool.core.util.StrUtil;
import com.google.common.base.CaseFormat;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

/**
 * 字符串工具类
 * @author shenguangyang
 */
@Slf4j
public class TmplStrUtils {
    public Boolean containsAnyIgnoreCase(CharSequence str, CharSequence... testStrs) {
        log.info("invoke containsAnyIgnoreCase, str: {}, testStrs: {}", str, testStrs);
        return StrUtil.containsAnyIgnoreCase(str, testStrs);
    }

    /**
     * 小驼峰转为大驼峰 <br/>
     * test -> Test
     * testData -> TestData
     */
    public String lowerCamelToUpperCamel(CharSequence str) {
        if(StringUtils.isEmpty(str)) {
            return "";
        }
        log.info("invoke lowerCamelToUpperCamel, str: {}", str);
        return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, String.valueOf(str));
    }
}
